﻿@{
    ViewBag.Title = "教学统计";
}
<div class="wrapper animated fadeInRight autoHeight">
    <!-- Panel Other -->
    <div class="row autoHeight" style="background-color: #fff;">
        <div class="col-sm-12 col-sm-leftRight">
            <!-- Example Toolbar -->
            <div class="example">
                <table id="exampleTableToolbar" data-mobile-responsive="true" data-radio="true" style="table-layout: fixed !important;"></table>
            </div>
            <!-- End Example Toolbar -->
        </div>
    </div>
    <!-- End Panel Other -->
</div>

@section footSection{
    <script>
    var options, $table;
    var user_id, file_id,unit_name,type_text;
    var entryManager = {
        initPage: function () {
            showLoadBoxs();
            entryManager.initData();
            entryManager.initTable();
            delLoadBoxs();
        },
        initData:function(){
            user_id = $.getUrls('user_id');
            file_id = $.getUrls('file_id');
            unit_name = $.getUrls('unit_name');
            if (unit_name)
                unit_name = decodeURI(unit_name);
            type_text = $.getUrls('type_text');
            if (type_text)
                type_text = decodeURI(type_text);
        },
        initTable: function () {
            options = {
                url: ctx + "/Teach/GetDetialData",
                cutHeight: 5,
                showRefresh: false,
                showToggle: false,
                showColumns: false,
                //toolbar: "#exampleToolbar",
                queryParams: function (params) {
                    params = {
                        rows: params.limit,
                        //页面大小
                        page: params.offset / params.limit + 1,
                        user_id: user_id,
                        file_id: file_id
                    }
                    return params;
                },
                columns: [
                    {
                        radio: true
                    },
                    {
                        field: '',//第一列序号
                        title: '序号',
                        align: 'center',
                        width: 50,
                        formatter: function (value, row, index) {
                            return index + 1;
                        }
                    },
                    {
                        field: 'unit_name',
                        title: '所属班级',
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (unit_name) 
                                return unit_name;
                            return "";
                        }
                    }, {
                        field: 'user_name',
                        title: '姓名',
                        align: 'center'
                    }, {
                        field: 'file_name',
                        title: '课件名称',
                        align: 'center'
                    }, {
                        field: 'type_text',
                        title: '所属分类',
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (type_text)
                                return type_text;
                            return "";
                        }
                    }, {
                        field: 'in_date',
                        title: '开始学习',
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (value)
                                return $.formatDataLong(value);
                            return "";
                        }
                    }, {
                        field: 'out_date',
                        title: '退出学习',
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (value)
                                return $.formatDataLong(value);
                            return "";
                        }
                    }, {
                        field: 'em_time',
                        title: '学习时长',
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (value) {
                                if (value > 60)
                                    return (value / 60).toFixed(2) + "小时";
                                return value + "分钟";
                            }
                            return "";
                        }
                    }, {
                        field: 'status',
                        title: '状态',
                        align: 'center',
                        formatter: function (value, row, index) {
                            if (value)
                                return "<span class='label label-success'>达标</span>";
                            return "<span class='label label-danger'>未达标</span>";
                        }
                    }, {
                        field: 'out_time',
                        title: '退出时间点',
                        align: 'center'
                    }]
            }
            $table = tableHelper.initTable("exampleTableToolbar", options);
        }
    }
    $(function () {
        entryManager.initPage();
    });
    </script>
}